package 结构型设计模式.策略模式.demo;

/**
 * 策略模式的上下文
 *
 * 管理各种策略的实现
 * @Author lf
 * @Date 3/23/2024
 */
public class GreetingContext {
    private GreetingStrategy strategy;

    public void setStrategy(GreetingStrategy strategy) {
        this.strategy = strategy;
    }

    public void executeStrategy(String name) {
        strategy.greet(name);
    }
}
